module DataProcView where

import Graphics.UI.Gtk
import Graphics.UI.Gtk.ModelView as MV

data ViewState = V 
    {
      mainWidget :: Widget
    , shellView :: Widget
    , haskellView :: Widget
    , shellOrHaskellContainer :: VBox
    , useShellRB :: RadioButton 
    , useHaskellRB :: RadioButton
    }

new :: Widget -> Widget -> Widget -> Widget -> IO ViewState
new sv rv tv haskellView = do

  useShellRB <- radioButtonNewWithLabel "Input From Shell"
  useHaskellRB <- radioButtonNewWithLabelFromWidget useShellRB "Haskell Code"
  vbox <- vBoxNew False 0

  radioButtonHBox <- hBoxNew False 0
  boxPackStart radioButtonHBox useShellRB PackNatural 2
  boxPackStart radioButtonHBox useHaskellRB PackNatural 2
  boxPackStart vbox radioButtonHBox PackNatural 2
  
  shellOrHaskellContainer <- vBoxNew False 0
  boxPackStart vbox shellOrHaskellContainer PackNatural 2

  shellView <- vBoxNew False 2
  vbox2 <- vBoxNew False 0
  w1ex <- expanderNew "Shell Command"
  expanderSetExpanded w1ex True
  containerAdd w1ex sv
  w2ex <- expanderNew "Splitter Regex"
  expanderSetExpanded w2ex False
  containerAdd w2ex rv
  boxPackStart vbox2 w1ex PackNatural 2
  boxPackEnd vbox2 w2ex PackNatural 2
  boxPackStart shellView vbox2 PackNatural 2
  boxPackStart shellOrHaskellContainer shellView PackNatural 2
  
  boxPackEnd vbox tv PackGrow 2
  
  return (V 
          (toWidget vbox) 
          (toWidget shellView) 
          (toWidget haskellView) 
          shellOrHaskellContainer 
          useShellRB 
          useHaskellRB)

